<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport"
	content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" />
<link rel="stylesheet" href="../../resources/css/app.css"
	type="text/css" />
<title>AIOS Visualization</title>
	<script type="text/javascript" src="../../resources/js/dataTables.js" charset="utf-8"></script>
<script type="text/javascript"
	src="../../resources/js/sencha-touch-all-debug.js" charset="utf-8"></script>
<script>
	Ext
			.application({
				name : 'AIOS',

				launch : function() {
					Ext
							.create(
									"Ext.tab.Panel",
									{
										fullscreen : true,
										activeItem : 4,
										tabBarPosition : 'bottom',

										items : [

												//************************************** Disabled **************************************************************************				        

												{
													title : ' d',
													id : 'displayNone',
													styleHtmlContent : true,
													scrollable : true,

													listeners : {
														activate : function() {
															this
																	.setHidden(true);
														}
													},
												},

												//************************************ Home ************************************************
												{
													title : 'ホーム',
													iconCls : 'home',
													styleHtmlContent : true,
													scrollable : true,
													listeners : {
														activate : function() {
															document.location.href = "../../index.html"
														}
													},

													items : [

													]
												},

												//********************************** Day View ***********************************************						

												{
													title : '電力見える化',
													iconCls : 'search',
													styleHtmlContent : true,
													scrollable : true,
													listeners : {
														activate : function() {
															document.location.href = "dayView.html"
														}
													},

													items : []
												},

												//************************************ Statistic View ***************************************						
												{
													title : '制御ログ',
													iconCls : 'plug',
													styleHtmlContent : true,
													scrollable : true,
													listeners : {
														activate : function() {
															document.location.href = "statisticView.html"
														}
													},

													items : [

													]
												},

												//******************************** Statistic with chart View *************************************						
												{
													title : '統計',
													iconCls : 'chart',
													styleHtmlContent : true,
													scrollable : true,
													listeners : {
														activate : function() {

															Ext.data.JsonP
																	.request({
																		url : 'http://153.121.40.23:8080/aios-api/aios/api/GetCurrentPower.php',
																		method : 'POST',
																		callbackkey : 'callback',
																		params : {
																			tap_id : 1
																		},

																		scope : this, /// fix handler scope

																		callback : function(
																				response,
																				value,
																				request) {
																			var wattComponent = Ext
																					.getCmp('s_watt');
																			wattComponent
																					.setValue(value.response.electric_power);

																			var ampereComponent = Ext
																					.getCmp('s_ampere');
																			ampereComponent
																					.setValue(value.response.electric_current);

																		},

																		failure : function(
																				response,
																				request) {
																			Ext.Msg
																					.alert("申し訳ありませんが、再試行してください... </br>"
																							+ response);
																		}
																	});

														}
													},

													items : [

															//////////// Header /////////////////		        
															{
																docked : 'top',
																xtype : 'titlebar',
																title : '統計',
																items : [ {
																	xtype : 'button',
																	align : 'right',
																	ui : 'round',
																	iconCls : 'home',
																	text : 'ホーム',
																	handler : function() {
																		document.location.href = "../../index.html";
																	}

																} ]
															},

															//////////////// Set Current Wattage and Amperage ///////////////
															{

																xtype : 'fieldset',
																layout : {
																	type : 'hbox',
																	pack : 'start',
																	align : 'middle'
																},
																items : [

																		{
																			xtype : 'label',
																			html : '現在の使用電力（全体) - ',
																		},
																		{
																			xtype : 'textfield',
																			id : 's_watt',
																			clearIcon : false,
																			label : 'W :',
																		},
																		{
																			xtype : 'textfield',
																			id : 's_ampere',
																			clearIcon : false,
																			label : 'A :',
																		} ]

															},
															{
																xtype: 'fieldset',
																id: 'gd',
										 		    		 	layout: {
										 		                    type: 'hbox',
										 		                   align: 'left'
										 		                },
										 		    			items: [
																			 {
																				xtype: 'fieldset',
																				width: '80%',
																				styleHtmlContent: true,
																				html: [generateHtmlMainSettingTable()],
																			} , 
																			/* {	
												 		    				 	xtype: 'textfield',
												 		    				 	label: '契約電流［Ａ］',
												 		    				 	value : '50',
												 		    				 	clearIcon : false,
												 		    				 	
												 		    				}, */
												 		    				{	
												 		    				 	xtype: 'label',
												 		    				 	html: '和室照明 OFF </br> 和室テレビOFF ', 
												 		    				},
										 		    			        ]
															}
															

													]
												},

												//********************************** Settings View ********************************************						
												{
													title : '設定',
													iconCls : 'settings',
													styleHtmlContent : true,
													scrollable : true,
													listeners : {
														activate : function() {
															document.location.href = "settingView.html"
														}
													},

													items : []

												} ]
									});
				}
			});
</script>



</head>

<body>

</body>

</html>
